package com.astoolkit.workflow
{
	import com.astoolkit.workflow.api.ITasksGroup;
	import com.astoolkit.workflow.api.IWorkflow;
	import com.astoolkit.workflow.api.IWorkflowElement;
	import com.astoolkit.workflow.api.IWorkflowTask;
	
	import flash.events.EventDispatcher;
	
	[DefaultProperty("children")]
	public class TasksGroup extends EventDispatcher implements ITasksGroup
	{
		protected var _children : Vector.<IWorkflowElement>;
		protected var _enabled : Boolean = true;
		protected var _parent : ITasksGroup;
		protected var _currentThread : uint;
		protected var _tasks : Vector.<IWorkflowTask>;
		protected var _insert : Vector.<Insert>;
		protected var _description : String;
		
		public function get description():String
		{
			return _description;
		}
		
		public function set description(inName:String):void
		{
			_description = inName;
		}
		

		public function set insert(inInsert:Vector.<Insert>):void
		{
			_insert = inInsert;
			
		}
		
		public function get insert():Vector.<Insert>
		{
			return _insert;
		}
		
		
		public function get children():Vector.<IWorkflowElement>
		{
			return _children;
		}
		
		public function set children( inTasks:Vector.<IWorkflowElement>):void
		{
			_children = inTasks
		}
		
		protected function get runtimeTasks() : Vector.<IWorkflowTask>
		{
			if( !_tasks )
				_tasks = GroupUtil.getRuntimeTasks( _children );
			return _tasks;
		}

		public function get currentThread():uint
		{
			return _currentThread;
		}
		
		
		public function get enabled():Boolean
		{
			return enabled;
		}
		
		public function set enabled(inEnabled:Boolean):void
		{
			_enabled = inEnabled;
		}
		
		public function initialize():void
		{
		}
		
		public function prepare():void
		{
		}
		
		public function cleanUp():void
		{
		}
		
		public function get parent():ITasksGroup
		{
			return _parent;
		}
		
		public function set parent(inParent:ITasksGroup):void
		{
			_parent = inParent;
		}
		
	}
}